import traceback

def risky_function():
    try:
        x = int(input("请输入一个数字: "))
        y = 5 // x
        print(y)

    except Exception as err:
        with open('error_log.txt', mode='a') as log_file:
            log_file.write(traceback.format_exc())
        print("已保存日志到文件")
    
risky_function()